<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>客户管理</title>
<link th:href="@{/css/style.css}" rel="stylesheet" type="text/css" />
<script type="text/javascript" th:src="@{/js/jquery.js}"></script>
<script type="text/javascript">
function deltipOpen(ele) {
	$("#deltip").fadeIn(200);
	$("#purchaseId2").val($(ele).prev().val());
}
function deltipClose() {
	$("#deltip").fadeOut(200);
}
function deltipQueDing() {
    $("#deltip").fadeOut(200);
    var purchaseId=$("#purchaseId2").val();
    window.location.href="/erp1/purchase/purchase/delPurchase?purchaseId="+purchaseId;
}
function examinetipOpen(ele) {
	$("#examinetip").fadeIn(200);
	var pur=$(ele).prev().val();
	$("#pruchase").val(pur);
}
function examinetipclose() {
	$("#examinetip").fadeOut(200);
}

function examinetipQueDing() {
    $("#examinetip").fadeOut(200);
    var pur=$("#pruchase").val();
    var chId=$("#uId2").val();
    console.log(chId)
    window.location.href="/erp1/purchase/purchase/editStatus?purchaseId="+pur+"&checkId="+chId;
}
</script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li>采购管理</li>
    <li>采购单管理</li>
    <li>基本内容</li>
  </ul>
</div>
<div class="rightinfo">
  <form th:action="@{/purchase/purchase/purchaseAll}" method="post" id="purchasefrom">
    <ul class="tools">
      <input type="hidden" name="pageno" value="1" id="pageno"/>
      <li> 采购单编号:
      <input type="text" name="purchaseId"  th:value="${pur.purchaseId}"/>
    </li>
      <li> 采购时间:
        <input type="date" name="mintime" th:value="${minTime}"/>-
        <input type="date" name="maxtime" th:value="${maxTime}"/>
      </li>
      <li> 金额:
        <input type="text" class="stinput" name="mintotal" th:value="${mintotal}"/>-
        <input type="text" class="stinput" name="maxtotal" th:value="${maxtotal}" />
      </li>
      <li> 审核状态：
        <select name="checkStatus">
          <option value="0">请选择</option>
          <option th:value="1" th:selected="${pur.checkStatus==1?'true':'false'}">未审核</option>
          <option th:value="2" th:selected="${pur.checkStatus==2?'true':'false'}">审核中</option>
          <option th:value="3" th:selected="${pur.checkStatus==3?'true':'false'}">审核通过</option>
          <option th:value="4" th:selected="${pur.checkStatus==4?'true':'false'}">审核未通过</option>
        </select>
      </li>
      <li class="subBut" onclick="goPage(1)"><img th:src="@{/images/t06.png}" />查询</li>
      <li class="subBut" onclick="window.location.href='/erp1/purchase/purchase/goAdd'"><img th:src="@{/images/t01.png}" />添加</li>
    </ul>
    <table class="tablelist">
      <thead>
        <tr>
          <th>序号</th>
          <th>采购单编号</th>
          <th>采购时间</th>
          <th>金额</th>
          <th>操作人</th>
          <th>审核状态</th>
          <th>审核人</th>
          <th>审核时间</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody>
        <tr th:each="p,var:${pb.list}">
          <td th:text="${(pb.pageNum-1)*pb.pageSize+var.count}">1</td>
          <td th:text="${p.purchaseId}">CG201701270001</td>
          <td th:text="${#dates.format(p.purchaseTime,'yyyy-MM-dd HH:mm:ss')}">2017-01-25 15:05:05</td>
          <td th:text="'￥'+${p.totalMoney}">￥9,876,582</td>
          <td th:text="${p.causers.uname}">关羽</td>
          <td th:if="${p.checkStatus==1}">未审核</td>
          <td th:if="${p.checkStatus==2}">审核中</td>
          <td th:if="${p.checkStatus==3}">审核通过</td>
          <td th:if="${p.checkStatus==4}">审核未通过</td>
          <td th:text="${p.checkId==null || p.checkStatus==2?'':p.chusers.uname}"></td>
          <td th:text="${p.checkStatus==2?'':#dates.format(p.checkTime,'yyyy/MM/dd hh:MM:ss')}"></td>
          <td>
            <a th:href="@{'/purchase/purchase/goUpdatePur?purchaseId='+${p.purchaseId}}" th:if="${p.checkStatus==1||p.checkStatus==4?'true':'false'}" class="tablelink">修改</a>
            <input type="hidden" th:value="${p.purchaseId}">
            <a href="javascript:void(0);" th:if="${p.checkStatus==1?'true':'false'}" class="tablelink" onclick="deltipOpen(this)">删除</a>
            <input type="hidden" th:value="${p.purchaseId}">
            <a href="javascript:void(0);" th:if="${p.checkStatus==1||p.checkStatus==4?'true':'false'}" class="tablelink" onclick="examinetipOpen(this)">提交审核</a>
            <a th:href="@{'/purchase/purchase/viewPurchase?purchaseId='+${p.purchaseId}}" th:if="${p.checkStatus==2||p.checkStatus==3?'true':'false'}" class="tablelink">查看详情</a>
            <a th:href="@{'/purchase/purchase/stockPurchase/'+${p.warehuoseId}}" th:if="${p.checkStatus==3?'true':'false'}" class="tablelink">入库详情</a>
            </td>
        </tr>

      </tbody>
    </table>
    <div class="pagin">
      <div class="message">共<i class="blue" th:text="${pb.total}"></i>条记录，当前显示第&nbsp;<i class="blue" th:text="${pb.pageNum}">2&nbsp;</i>页</div>
      <ul class="paginList">
        <li class="paginItem">
          <a href="javascript:void(0);" th:onclick="goPage([[${pb.isFirstPage?1:pb.pageNum-1}]])">
            <span th:class="${pb.isFirstPage?'pagepre':'pagenxt roate'}"></span>
          </a>
        </li>
        <li th:class="${page==pb.pageNum?'paginItem current':'paginItem'}"
            th:each="page : ${pb.navigatepageNums}">
          <a href="javascript:;"  th:text="${page}" th:onclick="goPage([[${page}]])">1</a>
        </li>
        <li class="paginItem">
          <a href="javascript:void(0);" th:onclick="goPage([[${pb.isLastPage?pb.pages:pb.pageNum+1}]])">
            <span th:class="${pb.isLastPage?'pagepre roate':'pagenxt'}"></span>
          </a>
        </li>
      </ul>
    </div>
  </form>
  <!-- 删除提示框 -->
  <div id="deltip" class="tip">
    <div class="tiptop"><span>提示信息</span><a onclick="deltipClose()"></a></div>
    <div class="tipinfo"> <span><img th:src="@{/images/ticon.png}" /></span>
      <div class="tipright">
        <p>是否确认删除此条信息？</p>
        <cite>如果是请点击确定按钮 ，否则请点取消。</cite> </div>
    </div>
    <div class="tipbtn">
      <input type="hidden" id="purchaseId2">
      <input name="" type="button"  class="sure" value="确定" onclick="deltipQueDing()" />
      &nbsp;
      <input name="" type="button"  class="cancel" value="取消" onclick="deltipClose()" />
    </div>
  </div>
  
  <!-- 审批提示框 -->
  <div id="examinetip" class="tip">
    <div class="tiptop">
    	<span>提示信息</span><a onclick="examinetipclose()"></a>
    </div>
    <div class="tipinfo1"> 
    	
        部门：
            <select class="dfselect" disabled="disabled">
            	<option>请选择</option>
                <option>销售部</option>
                <option selected>采购部</option>
                <option>财务部</option>
            </select>
			<p/>
            职位：
            <select class="dfselect" disabled="disabled">
            	<option>请选择</option>
                <option selected>部门经理</option>
                <option>部门副经理</option>
                <option>部门主管</option>
            </select>
   			<p/>
            职位：
            <select class="dfselect" id="uId2" >
            	<option>请选择</option>
                <option th:each="u:${session.pusers}" th:value="${u.uId}" th:text="${u.uname}">刘备</option>

            </select>
			<p/>
    </div>
    <div class="tipbtn">
      <input type="hidden" id="pruchase"/>
      <input name="" type="button"  class="sure" value="确定" onclick="examinetipQueDing()" />
      &nbsp;
      <input name="" type="button"  class="cancel" value="取消" onclick="examinetipclose()" />
    </div>
  </div>
</div>
<script type="text/javascript">
	$('.tablelist tbody tr:odd').addClass('odd');

    function goPage(num) {
      // alert(num);
      $("#pageno").val(num);
      $("#purchasefrom").submit();
    }
</script>
</body>
</html>
